package com.function;

import com.function.domain.CallmeEvent;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageHeaders;
import org.springframework.messaging.support.GenericMessage;
import org.springframework.messaging.support.MessageBuilder;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Locale;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Consumer;

@Slf4j
@Configuration
public class StreamForConsumerFunction{
    // process / sink / source.
    // org.springframework.amqp.rabbit.listener.BlockingQueueConsumer
    @Bean
    public java.util.function.Consumer<CallmeEvent> callmeEventConsumer() {
        return (CallmeEvent event)->{
            log.info("received: {}",event);
        } ;
    }

    @Bean
    public java.util.function.Consumer<GenericMessage<CallmeEvent>> callmeEventWithHeaderConsumer() {
        return (GenericMessage<CallmeEvent> event)->{
            log.info("received2: {}",event);
        } ;
    }


}
